<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="net.ojbk.saishi.service.*" import="net.ojbk.saishi.po.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>已赛赛事页面</title>

<link href="css/bootstrap-jf.css" rel="stylesheet">
<link href="css/datepicker3-jf.css" rel="stylesheet">
<link href="css/styles-jf.css" rel="stylesheet">
<style type="text/css">
	
.text-overflow{ 
display:block;/*内联对象需加*/
word-break:keep-all;/* 不换行 */ 
white-space:nowrap;/* 不换行 */ 
overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */ 
text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ；需与overflow:hidden;一起使用。*/ 
} 
</style>
</head>
<%
boolean isLogin = false;
String userId = "null";
syMatch[] havaPart = new syMatch[0];
if ((session != null && session.getAttribute("login") != null && (boolean)session.getAttribute("login"))) { //如果登录
	userId = (String)session.getAttribute("myId");
	havaPart = ContestantService.getPartMatch(userId); // 获取所有自己已发布的赛事
	isLogin = true;
}

%>
<body>
		<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="home.jsp"><span>师易</span>赛事服务平台</a>
				<ul class="user-menu">
					<li class="dropdown pull-right">
						<a href="home.jsp" class="dropdown-toggle">个人主页</a>
					</li>
				</ul>
			</div>
							
		</div><!-- /.container-fluid -->
	</nav>
		
	<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
		<form role="search">
			<div class="form-group">
				<input type="text" class="form-control" placeholder="欢迎来到师易赛事服务平台">
			</div>
		</form>
		<ul class="nav menu">
			<li><a href="all.jsp"><span class="glyphicon glyphicon-stats"></span> 全部赛事</a></li> 
			<li role="presentation" class="divider"></li>  主办方
			<li><a href="launch.jsp"><span class="glyphicon glyphicon-list-alt"></span>发布赛事</a></li>
			<li><a href="havaLaunch.jsp"><span class="glyphicon glyphicon-dashboard"></span>已发布赛事</a></li>
			<li><a href="Statistics.jsp"><span class="glyphicon glyphicon-th"></span> 赛事情况统计</a></li>
			<li><a href="backstage.jsp"><span class="glyphicon glyphicon-th"></span> 赛事后台</a></li>
<!-- 			<li><a href="forms.jsp"><span class="glyphicon glyphicon-pencil"></span> Forms</a></li>
			<li><a href="panels.jsp"><span class="glyphicon glyphicon-info-sign"></span> Alerts &amp; Panels</a></li> -->
			<li role="presentation" class="divider"></li>  参赛方
			<li><a href="part.jsp"><span class="glyphicon glyphicon-user"></span> 参赛赛事</a></li>
			<li class="active"><a href="havaPart.jsp"><span class="glyphicon glyphicon-user"></span> 已赛赛事</a></li>
		</ul>
		<div class="attribution">赛事服务 by <a href="">师易</a></div>
	</div><!--/.sidebar-->
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">			
		<div class="row">
			<ol class="breadcrumb">
				<li><a href="#"><span class="glyphicon glyphicon-home"></span></a></li>
				<li class="active">Hava Part</li>
			</ol>
		</div><!--/.row-->
		

				
		
	<!--/.row-->		
		
		
		<div class="row">
			<div class="col-lg-12">
			<%
			if (isLogin) {
			%>
				<h2>已参加赛事</h2>
			<%} else {%>
				<h2>已参加赛事(未登录)</h2>
			<% } %>
			</div>
		</div><!-- /.row -->
			
		<%
		for (int i=0; i<havaPart.length; i+=3) {
		%>
		<div class="row">
			<%
			for (int j=i; j<havaPart.length && j<i+3; j++) {
			%>
			<div class="col-md-4">
				<div class="panel panel-info">
					<div class="panel-heading text-overflow">
					
					<a href="./saishi.jsp?matchId=<%= havaPart[j].getMatchId() %>">
						<%= havaPart[j].getTitle() %></a>
					</div>
					<div class="panel-body">
						<p><%= havaPart[j].getContent().substring(0, havaPart[j].getContent().length()<200 ? havaPart[j].getContent().length() : 200) %> </p>
					</div>
				</div>
			</div>
			<% 
			} 
			%>

		</div><!-- /.row -->
		<%
		}
		%>
			
		<!--/.col-->
			
	<script src="js/jquery-1.11.1.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/chart.min.js"></script>
	<script src="js/chart-data.js"></script>
	<script src="js/easypiechart.js"></script>
	<script src="js/easypiechart-data.js"></script>
	<script src="js/bootstrap-datepicker.js"></script>
	<script>
		!function ($) {
			$(document).on("click","ul.nav li.parent > a > span.icon", function(){		  
				$(this).find('em:first').toggleClass("glyphicon-minus");	  
			}); 
			$(".sidebar span.icon").find('em:first').addClass("glyphicon-plus");
		}(window.jQuery);

		$(window).on('resize', function () {
		  if ($(window).width() > 768) $('#sidebar-collapse').collapse('show')
		})
		$(window).on('resize', function () {
		  if ($(window).width() <= 767) $('#sidebar-collapse').collapse('hide')
		})
	</script>	
</body>

</html>
